import { createRouter, createWebHashHistory } from 'vue-router';


export default createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      // 主页
      path: '/',
      name: 'home',
      component: () => import('@/views/home/index.vue'),
      // 重定向
      redirect: '/',
      children: [
        {
          // 首页
          path: '',
          name: 'homepage',
          component: () => import('@/views/home/homepage/index.vue'),
        },
        {
          // 居家
          path: '/livinghome/:id',
          name: 'livinghome',
          component: () => import('@/views/home/livinghome/index.vue'),
        },
        {
          // 二级商品分类
          path: '/category/sub/:id',
          name: '二级分类',
          component: () => import('@/views/home/sub-category/index.vue'),
        },
        {
          // 三级商品分类
          path: '/product/:id',
          name: '三级分类',
          component: () => import('@/views/home/product/index.vue'),
        },
      ],
    },
    {
      // 登录
      path: '/login',
      component: () => import('@/views/login/index.vue'),
    },
  ],
});
